<div class="page-content">
    <div>
    <span class="btn  btn-primary pull-right" onclick="javascript:window.location.href = '/配料单EXCEL模板.xlsx'">
     下载模板
        </span>

        <div class="col-sm-7 pull-right">

            <form class="form-inline pull-left" method="post" action="/admin/excel/index" enctype="multipart/form-data">

                <div class="form-group">
                    <div class="input-group">

                        <!--  <input type="text" class="form-control"  onkeydown="return false;" onpaste="return false;" placeholder="Select file...">
                          <label class="input-group-btn">
                          <span class="btn btn-primary">
                              <i class="glyphicon glyphicon-folder-open"></i>  
                              Browse… <input type="file" style="display: none;" multiple>
                          </span>
                          </label> -->

                        <input type="file" style="display: none" class="form-control file" name="excel" id="thisfile" value="">
                        <div class="input-append">
                            <!-- 用于展示上传文件名的表单 -->
                            <input id="showname" class="form-control" type="text" style="height: 40px">
                            <!-- 点击触发按钮 -->
                            <a class="btn btn-primary" style="height: 40px" onclick="makeThisfile()" id="browse">浏览</a>
                        </div>
                    </div>
                </div>
                <button type="submit" class="btn btn-primary dr" style="margin-left: 15px;">读表</button>

            </form>
            <span class="btn  btn-primary pull-left" style="margin-left: 5px;"
                  onclick="javascript:window.location.href = '/admin/excel/import'">
      导入
        </span>
        </div>
    </div>
    <div class="page-header">
        <h1>
            {:model('menu')->getName()}
        </h1>
    </div><!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <div class="row">
                <div class="col-xs-12">
                    <table id="simple-table" class="table  table-bordered table-hover">
                        <thead>
                        <tr>

                            <th>配料物料</th>
                            <th>序列号</th>
                            <th>类型标志</th>
                            <th class="hidden-480">编码</th>
                            <th>数量</th>
                            <th>描述</th>
                            <th>备注</th>
                            <th>配料单号</th>
                        </tr>
                        </thead>

                        <tbody>
                        {volist name="lists" id="vo"}
                        <tr>
                            <td>{$vo.groupno}</td>
                            <td>{$vo.id}</td>
                            <td>{$vo.typeflg}</td>
                            <td>{$vo.itemno}</td>
                            <td>{$vo.qty}</td>
                            <td>{$vo.descript}</td>
                            <td>{$vo.remarks}</td>
                            <td>{$vo.groupid}</td>

                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div><!-- /.span -->
            </div><!-- /.row -->

            <!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->
<script type="text/javascript">
    $(function () {
        $(".dr").click(function () {
            var str = $("#thisfile").val();
            if (str == '') {
                alert('要导入的东西不能为空');
                return false;
            }
        })
    })

    function makeThisfile() {
        $('#thisfile').click();
    }

    //file表单选中文件时,让file表单的val展示到showname这个展示框
    $('#thisfile').change(function () {
        $('#showname').val($(this).val())
    })
</script>
<style type="text/css">
    #browse {
        border: 1px solid #ccc;
        border-radius: 4px;
        background-color: #2c9a8a;
        color: #fff;
    }
</style>


